package com.minivision.fdiot.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Entity
@Setter
@Getter
@EntityListeners(AuditingEntityListener.class)
public class MqttLog extends BaseEntity {

  private static final long serialVersionUID = -3277372141426570361L;
  
  @NotBlank
  @ApiModelProperty(value = "设备编号")
  private String deviceSn;
  @NotBlank
  @ApiModelProperty(value = "设备类型")
  private String model;
  @NotNull
  @ApiModelProperty(value = "消息代码")
  private Integer cmdCode;
  @NotBlank
  @ApiModelProperty(value = "消息名称")
  private String cmdName;
  
  @Column(columnDefinition = "TEXT")
  @NotBlank
  @ApiModelProperty(value = "消息内容")
  private String message;
  @NotBlank
  @ApiModelProperty(value = "消息序列化的类class")
  private String msgType;
  
  @Override
  public String toString() {
    return "MqttLog [deviceSn=" + deviceSn + ", model=" + model + ", cmdName=" + cmdName
        + ", msgType=" + msgType + "]";
  }

}
